function du=qy(y)
% convert monthly series to quarterly one
% if only one month available at the end of series, get rid of the last
% month

du=[];
if size(y,1)==1
    y=y';
end
if length(y)/4==int64(length(y)/4)
    for i=1:4:size(y,1)
        du=[du ; sum(y(i:i+2,:))/4];
    end;
else
    for jj=1:3
        if ((length(y)-jj)/4)==int64((length(y)-jj)/4)
            for i=1:4:size(y,1)
                if i<size(y,1)-jj
                    du=[du ; sum(y(i:i+2,:))/4];
                else
                    % use only the data available to infer the avg over the
                    % last period
                    if jj==3
                  %      'I used only two last months'
                    du=[du ; sum(y(i:i+jj-1,:))/jj];
                    end
                end;

            end
        end
    end
end